package org.elanfox.intellicommunity.biz.entity.resident;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
import org.elanfox.intellicommunity.biz.entity.BasePO;
import org.elanfox.intellicommunity.biz.entity.equipment.CardPO;
import org.elanfox.intellicommunity.common.ienum.UserEnums;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;

/**
 * 用户po
 *
 * @author loutianxi
 * @date 2019-12-03
 */
@Entity
@Table(name = "t_user")
@Setter
@Getter
@Cacheable(false)
public class UserPO extends BasePO {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "user_id")
    private Integer userId;
    /**
     * 姓名
     */
    @Column(name = "name")
    private String name;
    /**
     * 性别
     */
    @Column(name = "sex")
    private Integer sex;
    /**
     * 年龄
     */
    @Column(name = "age")
    private Integer age;
    /**
     * 手机号
     */
    @Column(name = "mobile")
    private String mobile;
    /**
     * 用户持有卡
     */
    @OneToOne(mappedBy = "user")
    @JsonIgnoreProperties("user")
    @NotFound(action = NotFoundAction.IGNORE)
    private CardPO card;
    /**
     * 用户类型
     */
    @Column(name = "user_type")
    private UserEnums.Type userType;
    /**
     * 删除标识
     */
    @Column(name = "del_flag")
    private boolean delFlag = true;

    /**
     * 用户房间号（楼号-房间号）
     */
    @Column(name = "room_number")
    private String roomNumber;
    /**
     * 住户特征
     * {@link org.elanfox.intellicommunity.common.ienum.UserEnums.Feature}
     */
    @Column(name = "feature")
    private UserEnums.Feature feature;

    @Column(name = "steward")
    private Boolean steward;
}
